Row

confirmed

1163

Active Cases

910

recovered

223

death

30

Row

Map

Daily cumulative cases

Row

Zipcode cases

Town cases

Row

Daily counts

Daily counts

date confirmed active recovered deaths
24 2020-04-06 1163 910 223 30
23 2020-04-05 1059 861 171 27
22 2020-04-04 945 758 161 26
21 2020-04-03 802 639 141 22
20 2020-04-02 734 614 101 19
19 2020-04-01 603 510 81 12
18 2020-03-31 553 481 62 10
17 2020-03-30 463 402 53 8
16 2020-03-29 414 375 32 7
15 2020-03-28 380 347 27 6
14 2020-03-27 310 277 27 6
13 2020-03-26 221 200 16 5
12 2020-03-25 146 139 5 2
11 2020-03-24 121 121 0 0
10 2020-03-23 96 96 0 0
9 2020-03-22 64 64 0 0
8 2020-03-21 56 56 0 0
7 2020-03-20 47 47 0 0
6 2020-03-19 29 29 0 0
5 2020-03-18 27 27 0 0
4 2020-03-17 20 20 0 0
3 2020-03-16 7 7 0 0
2 2020-03-15 7 7 0 0
1 2020-03-14 3 3 0 0
---
title: COVID19 in Erie county
date: "`r gsub('\\(updated |\\ EST)|/2020', '', attributes(Counts$counts)$update.time)`"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    navbar:
      - { icon: fa-github, href: "https://github.com/hubentu/COVID19Erie"}
      - { title: "Erie Case Map", href: "https://erieny.maps.arcgis.com/apps/opsdashboard/index.html#/dd7f1c0c352e4192ab162a1dfadc58e1"}
      - { title: "Global Map", href: "https://coronavirus.jhu.edu/map.html"}
    social: menu
    source_code: embed
    vertical_layout: scroll
---

```{r setup, include=FALSE, eval=FALSE}
library(flexdashboard)
library(fontawesome)
library(COVID19Erie)
pubExposed <- exposedPub()
```

```{r, eval=FALSE}
Counts <- caseCounts()
counts <- Counts$counts
ctable1 <- rbind(counts,
                c(town = "Total", colSums(counts[,-1])))
ycount <- historyCount$confirmed[historyCount$date == Sys.Date() - 1]
ncount <- attributes(counts)$total.confirmed - ycount
```

Row {data-width=300}
-----------------------------------------------------------------------

### confirmed {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.confirmed,
  caption = paste0("Total confirmed cases (+", ncount, ")"),
  icon = "fas fa-ambulance",
  color = "purple"
)
```

### Active Cases {.value-box}
```{r}
valueBox(
  value = attributes(counts)$active.cases,
  caption = "Active cases",
  icon = "fas fa-hospital-user",
  color = "#1f77b4"
)
```

### recovered {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.recovered,
  caption = "Total recovered cases",
  icon = "fas fa-head-side-mask",
  color = "forestgreen"
)
```

### death {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.deaths,
  caption = "Death cases",
  icon = "fas fa-heart-broken",
  color = "#474747"
)
```


Row {data-height=600}
-----------------------------------------------------------------------
    
### Map
    
```{r}
caseMap(Counts, pubExposed, titlePos = NULL)
```

### Daily cumulative cases
```{r}
countPlot(historyCount)
```

Row
---------------------------------------------------------------------

### Zipcode cases
```{r}
library(DT)
datatable(Counts$zipCounts, options = list(scrollX = T))
```

### Town cases

```{r}
## library(knitr)
## library(kableExtra)
## kable(ctable1,
##       caption = "COVID19 cases (Erie county)") %>%
##     kable_styling(full_width = TRUE) %>% 
##     footnote(general = c(paste("Last updated:", attributes(counts)$update.time),
##                          "[Data Source](https://erieny.maps.arcgis.com/apps/opsdashboard/index.html#/dd7f1c0c352e4192ab162a1dfadc58e1)",
##                          "[Public Advisories](http://www2.erie.gov/health/index.php?q=public-advisories)",
##                          "The data is only for educational and academic research purposes.")) %>%
## scroll_box(height = "600px")
datatable(ctable1[,1:2], options = list(scrollX = T))
```

Row
----------------------------------------------------------------------

### Daily counts {.no-mobile}
```{r}
datatable(historyCount[order(historyCount$date, decreasing = TRUE),],
          extensions = 'Scroller',
          options = list(scrollX = TRUE))
```

### Daily counts {.mobile}
```{r}
library(knitr)
library(kableExtra)
kable(historyCount[order(historyCount$date, decreasing = TRUE), -3]) %>%
    kable_styling()%>%
    scroll_box(height = "600px", width = "100%")
```